True this frame if the named action is held down (see btn_held for the raw-button equivalent). The action is one of the names in your project’s Project Settings, written as a plain word: `action_held(jump)`.
action_held(a) -> bool| Name | Type |
|---|---|
a | action |
bool
True this frame if the named action is held down - the same check as btn_held, but you ask about a name your project chose (fire, jump) instead of a fixed button. Which button that name means is decided in Project Settings, and can be changed while the game runs with action_rebind. Your code does not change when the button does.
The name is one of the actions listed under Input actions in Project Settings, written as a plain word, with no quotes. It is checked before the game is built: a name that is not in Project Settings is an error, and so is a number or a button (action_held(BTN_A)) where the action goes. Project settings explains where actions come from and what happens to one with no button.
An action can have more than one button. Then it is held when any of them is held.
if (action_held(fire)) {
var shooting = true;
}fire is whichever button or buttons Project Settings gave it. This is true on every frame one of them is down.
var which = jump;
if (action_held(which)) {
var jumping = true;
}An action is a value you can keep in a variable and hand around. which is jump here, so this asks the same question as action_held(jump).
The action is whatever buttons Project Settings gave it, and the engine keeps that mapping - so action_rebind() changes what it means for the rest of the run, and no code that asks about the action needs to change. An action with several buttons counts as held down when ANY of them is; an action with no buttons is never true.